using UnityEngine;

public class DisableObjectOnShoot : SynchronizedGameObject
{
	public GameObject[] obj;

	private new void Start()
	{
		BaseWeapon component = GetComponent<BaseWeapon>();
		if (base.isMine)
		{
			component.AddEventListener(this, "ChangeChargerAmmo", delegate(Object sender, object[] args)
			{
				SetAmmo((int)args[0]);
			}, false);
		}
		SetAmmo(obj.Length);
	}

	public void SetAmmo(int val)
	{
		RPC("SetAmmo", PhotonTargets.Others, val);
		for (int i = 0; i < obj.Length; i++)
		{
			if (obj[i] != null)
			{
				obj[i].SetActive(val > i);
			}
		}
	}
}
